package com.tanhua.server.service;

import com.tanhua.dubbo.api.UserLocationApi;
import com.tanhua.server.interceptor.UserHolder;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class BaiduService {
    @Reference
    private UserLocationApi userLocationApi;

    /**
     * 上报地理位置
     */
    public ResponseEntity saveLocation(Double latitude, Double longitude, String address) {
        Long userId = UserHolder.getUser().getId();
        userLocationApi.save(latitude, longitude, address, userId);
        log.info("上报地理位置信息：[经度:{}, 维度:{}, address:{}]",longitude, latitude, address);
        return ResponseEntity.ok(null);
    }
}
